<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:83:"/webHome/host6366235/www/public/../application/teacher/view/attendancess/index.html";i:1679839689;s:69:"/webHome/host6366235/www/application/teacher/view/public/footer3.html";i:1679839693;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo $setting['webname']; ?>-点名表</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <link rel="shortcut icon" href="/public/static/admin/uploads/set/<?php echo $setting['ico']; ?>">
    <link type="text/css" rel="stylesheet" href="/public/static/home/themes/css/base.css">
    <link type="text/css" rel="stylesheet" href="/public/static/home/themes/css/home.css">
    <script type="text/javascript" src="/public/static/home/themes/js/jquery.min.js"></script>
    <script type="text/javascript" src="/public/static/home/themes/js/slider.js"></script>
    <script type="text/javascript" src="/public/static/home/themes/js/tab.js"></script>
    <link rel="stylesheet" href="/public/static/admin/layui/css/layui.css">
    <link rel="stylesheet" href="/public/static/admin/css/font-awesome.css">
    <link rel="stylesheet" href="/public/static/home/css/aui.css">
    <style>
        .atten{
            margin-left:5px !important;line-height: 19px; height: 19px;border: 1px solid #e6e6e6;
        }
    </style>
</head>
<body>

<section class="aui-flexView">
    <header class="aui-navBar aui-navBar-fixed b-line">
        <a href="javascript:history.back(-1)" class="aui-navBar-item">
            <i class="icon icon-return"></i>
        </a>
        <div class="aui-center">
            <span class="aui-center-title">点名名单</span>
        </div>
        <a href="javascript:;" class="aui-navBar-item">
            <i class="icon icon-sys"></i>
        </a>
    </header>
    <section class="aui-scrollView">
        <div class="aui-mate-box">
                <?php foreach($apply as $val): ?>
                        <div class="aui-card-list aui-border-t aui-border-b" style="margin-bottom:0.4em;">
                            <div class="aui-card-list-header aui-card-list-user">
                                <div class="aui-card-list-user-name">
                                    <div class="aui-font-size-16"><?php echo $val['user']['name']; if($val['user']['sex'] == 1): ?> <span class="fa fa-mars" style="color:#0b4cb2"></span> <?php else: ?> <i class="fa fa-venus" style="color: #ff7090;"></i> <?php endif; ?> </div>
                                    <small>
                                        <?php if($val['status']==1): ?>
                                        <span style="color:#f8ac59"><i class="fa fa-thumb-tack"></i> 缴费核对中</span>
                                        <?php elseif($val['status']==2): ?>
                                        <span style="color:green"><i class="fa fa-check"></i> 已录取</span>
                                        <?php elseif($val['status']==3): ?>
                                        <span style="color:#2b57d9;"><i class="fa fa-times"></i> 拒绝</span>
                                        <?php elseif($val['status']==4): ?>
                                        <span style="color:#d9534f;"><i class="fa fa-times"></i> 待支付 </span>
                                        <?php elseif($val['status']==5): ?>
                                        <span style="color:#f8ac59;"><i class="fa fa-times"></i> 报名审核中 </span>
                                        <?php endif; ?>
                                        <span> | </span>
                                        <span><a href="<?php echo url('My/studentinfo'); ?>?id=<?php echo $val['user']['id']; ?>">查看信息 <i class="fa fa-arrow-right"></i></a></span>
                                    </small>
                                </div>
                                <div class="aui-card-list-user-info" style="padding:5px 0px;">
                                    <i class="fa fa-sitemap" aria-hidden="true"></i>
                                    <?php echo $val['bktype']; ?>
                                    <small style="float:right;"><i class="fa fa-user-secret" aria-hidden="true"></i> 负责老师：<?php echo $val['teacher']['name']; ?> </small>
                                    <div style="clear: both"></div>
                                </div>
                                <div class="aui-card-list-user-info">
                                    <i class="fa fa-phone-square" aria-hidden="true"></i>
                                    <?php echo $val['user']['phone']; ?>
                                    <small style="float:right;">

                                        <button class="layui-btn layui-btn-disabled layui-btn-radius layui-btn-xs atten atten<?php echo $val['user']['id']; ?>"  data-id="<?php echo $val['user']['id']; ?>" data-type="5">迟</button>
                                        <button class="layui-btn layui-btn-disabled layui-btn-radius layui-btn-xs atten atten<?php echo $val['user']['id']; ?>"  data-id="<?php echo $val['user']['id']; ?>" data-type="4">病</button>
                                        <button class="layui-btn layui-btn-disabled layui-btn-radius layui-btn-xs atten atten<?php echo $val['user']['id']; ?>"  data-id="<?php echo $val['user']['id']; ?>" data-type="3">事</button>
                                        <button class="layui-btn layui-btn-disabled layui-btn-radius layui-btn-xs atten atten<?php echo $val['user']['id']; ?>"  data-id="<?php echo $val['user']['id']; ?>" data-type="2">缺</button>
                                        <button class="layui-btn layui-btn-disabled layui-btn-radius layui-btn-xs atten atten<?php echo $val['user']['id']; ?>"  data-id="<?php echo $val['user']['id']; ?>" data-type="1">签</button>
                                        <span class="atten x close<?php echo $val['user']['id']; ?> atten<?php echo $val['user']['id']; ?>" style="border:0px;" data-id="<?php echo $val['user']['id']; ?>" data-type="6"><i class="fa fa-close"></i></span>
                                    </small>
                                </div>
                            </div>
                        </div>
                <?php endforeach; ?>
            </div>
            <div class="nothing">~~后面没有了~~</div>
    </section>
    <link href="/public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<footer class="aui-footer">
    <a href="<?php echo url('Indexs/index'); ?>" class="aui-tabBar-item ">
            <span class="aui-tabBar-item-icon">
                <i class="icon icon-home"></i>
            </span>
        <span class="aui-tabBar-item-text">首页</span>
    </a>
  <a href="<?php echo url('Newss/index'); ?>" class="aui-tabBar-item ">
            <span class="aui-tabBar-item-icon">
                <i class="fa fa-newspaper-o" style="font-size:18px !important;"></i>
            </span>
    <span class="aui-tabBar-item-text">动态</span>
  </a>
    <!--<a href="news.html" class="aui-tabBar-item">-->
    <!--    <span class="aui-tabBar-item-icon">-->
    <!--        <i class="icon icon-find"></i>-->
    <!--    </span>-->
    <!--    <span class="aui-tabBar-item-text">消息</span>-->
    <!--</a>-->
    <!--<a href="community.html" class="aui-tabBar-item">-->
    <!--    <span class="aui-tabBar-item-icon">-->
    <!--        <i class="icon icon-comm"></i>-->
    <!--    </span>-->
    <!--    <span class="aui-tabBar-item-text">社区</span>-->
    <!--</a>-->
    <a href="<?php echo url('My/index'); ?>" class="aui-tabBar-item aui-tabBar-item-active">
            <span class="aui-tabBar-item-icon">
                <i class="icon icon-car"></i>
            </span>
        <span class="aui-tabBar-item-text">我的</span>
    </a>
</footer>
</section>
<script src="/public/static/admin/layui/layui.js"></script>
<script>
    layui.use('upload', function() { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer, upload = layui.upload; //独立版的layer无需执行这一句
        var $atten_name = "";
        var name = ["","已签到","缺勤","事假","病假","迟到","撤销"];
        // layer.load(0,{shade:0.8,textAlign:"center"});
        layer.ready(function() {
            loading = layer.load(3,{shade:0.7});
        });
        $(".x").addClass("layui-btn-disabled");
        //获取今天已经签过到的
        $.post("<?php echo url('Attendancess/today_atten'); ?>",{},function(data){
            data.forEach((el)=>{
                var btn = $(".atten"+el.userid+"[data-type="+name.indexOf(el.name)+"]");
                switch(el.name){
                    case name[1] :
                        btn.removeClass("layui-btn-disabled");
                        $(".close"+el.userid).removeClass("layui-btn-disabled");
                        break;
                    case name[2] :
                        btn.removeClass("layui-btn-disabled");
                        $(".close"+el.userid).removeClass("layui-btn-disabled");
                        btn.addClass("layui-btn-danger");
                        break;
                    case name[3] :
                        btn.removeClass("layui-btn-disabled");
                        $(".close"+el.userid).removeClass("layui-btn-disabled");
                        btn.addClass("layui-btn-warm");
                        break;
                    case name[4] :
                        btn.removeClass("layui-btn-disabled");
                        $(".close"+el.userid).removeClass("layui-btn-disabled");
                        btn.addClass("layui-btn-warm");
                        break;
                    case name[5] :
                        btn.removeClass("layui-btn-disabled");
                        $(".close"+el.userid).removeClass("layui-btn-disabled");
                        btn.addClass("layui-btn-normal");
                        break;
                }

            })

            layer.closeAll('loading'); //关闭等待
        })

        //点击按钮
        $(".atten").on("click",function () {
            var atten = $(this);
            $(".atten"+atten.data('id')).addClass("layui-btn-disabled");
            $(".atten"+atten.data('id')).removeClass("layui-btn-danger");
            $(".atten"+atten.data('id')).removeClass("layui-btn-warm");
            $(".atten"+atten.data('id')).removeClass("layui-btn-normal");
            switch(atten.data("type")){
                case 1 :
                   atten.removeClass("layui-btn-disabled");
                   $(".close"+atten.data('id')).removeClass("layui-btn-disabled");
                   $atten_name = name[1];
                break;
                case 2 :
                    atten.removeClass("layui-btn-disabled");
                    $(".close"+atten.data('id')).removeClass("layui-btn-disabled");
                    atten.addClass("layui-btn-danger");
                    $atten_name = name[2];
                break;
                case 3 :
                    atten.removeClass("layui-btn-disabled");
                    $(".close"+atten.data('id')).removeClass("layui-btn-disabled");
                    atten.addClass("layui-btn-warm");
                    $atten_name = name[3];
                    break;
                case 4 :
                    atten.removeClass("layui-btn-disabled");
                    $(".close"+atten.data('id')).removeClass("layui-btn-disabled");
                    atten.addClass("layui-btn-warm");
                    $atten_name = name[4];
                    break;
                case 5 :
                    atten.removeClass("layui-btn-disabled");
                    $(".close"+atten.data('id')).removeClass("layui-btn-disabled");
                    atten.addClass("layui-btn-normal");
                    $atten_name = name[5];
                    break;
                case 6 :
                    $atten_name = name[6];
                    $(".close"+atten.data('id')).addClass("layui-btn-disabled");
                    break;
            }
            //签到
            $.post("<?php echo url('Attendancess/set_atten'); ?>",{userid:atten.data('id'),name:$atten_name},function(data){
                console.log(data);
            })
        });



    });
//    normal 蓝色
//    warm 橙色
//    danger 红色
//    disabled 禁用
</script>
</body>
</html>